//
//  MyProjectDetailViewController.m
//  WideHelp
//
//  Created by ENERGY on 2018/8/10.
//  Copyright © 2018年 ENERGY. All rights reserved.
//

#import "MyProjectDetailViewController.h"
#import "MemberStoryTableViewCell.h"
#import "LeaveMessageTableViewCell.h"
@interface MyProjectDetailViewController ()<UITableViewDelegate, UITableViewDataSource>
@property (nonatomic, strong)UITableView * tableView;
@property (nonatomic, strong)UIView * headerView;
@property (nonatomic, strong)UIView * footerView;
@property (nonatomic, strong)UILabel * nameLab;
@property (nonatomic, strong)UIImageView * bgImg;//背景图
@property (nonatomic, strong)NSMutableArray * storyArr;
@property (nonatomic, strong)NSMutableArray * messageArr;
@property (nonatomic, strong)UILabel * patientNameLab;//患者名
@property (nonatomic, strong)UILabel * diseaseLab;//疾病名
@property (nonatomic, strong)UILabel * stateLab;//城市以及申请资金
@property (nonatomic, strong)UIImageView * iconImg;//头像
@property (nonatomic, strong)UILabel * totalPersonContentLab;//已帮助人数
@property (nonatomic, strong)UILabel * totalMoneyContentLab;//已划拨互助款
@property (nonatomic, strong)UILabel * chargeContentLab;//平均充值
@property (nonatomic, strong)UILabel * rightContentLab;//延长权益
@property (nonatomic, strong)UILabel * familyContentLab;//挽救家庭
@end

@implementation MyProjectDetailViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title = @"计划详情";
    if (@available(iOS 11.0, *)) {
        self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
    }else {
        self.automaticallyAdjustsScrollViewInsets = NO;
    }
    [self.view addSubview:self.tableView];
    
    
}
#pragma mark - init
- (UITableView *)tableView{
    if (!_tableView) {
        _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT - BOTTOM_HEIGHT - NAVI_HEIGHT) style:UITableViewStyleGrouped];
        _tableView.delegate = self;
        _tableView.dataSource = self;
        _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
        [_tableView registerClass:[MemberStoryTableViewCell class] forCellReuseIdentifier:NSStringFromClass([MemberStoryTableViewCell class])];
        [_tableView registerClass:[LeaveMessageTableViewCell class] forCellReuseIdentifier:NSStringFromClass([LeaveMessageTableViewCell class])];
        _tableView.backgroundColor = [UIColor whiteColor];
        _tableView.tableHeaderView = self.headerView;
        _tableView.tableFooterView = self.footerView;
    }return _tableView;
}
- (UIView *)headerView{
    if (!_headerView) {
        _headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 305/WIDTH_6_SCALE)];
        _headerView.backgroundColor = [UIColor whiteColor];
        //背景图
        UIImageView * bgImg = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 177/WIDTH_6_SCALE)];
//        bgImg.backgroundColor = [UIColor cyanColor];
        bgImg.image = [UIImage imageNamed:@"plan_bg"];
        [_headerView addSubview:bgImg];
        self.bgImg = bgImg;
        //标语
        UILabel * sloganLab = [[UILabel alloc] initWithFrame:CGRectMake(0, 20/WIDTH_6_SCALE, SCREEN_WIDTH, 14/WIDTH_6_SCALE)];
        [self label:sloganLab withFont:DEF_FontSize_14 withText:@"请让博帮互助守护您的家人" withTextColor:[UIColor blackColor] withTextAlignment:NSTextAlignmentCenter withView:_headerView withBGColor:[UIColor clearColor]];
        //用户名
        self.nameLab = [[UILabel alloc] initWithFrame:CGRectMake(0, sloganLab.bottom + 16/WIDTH_6_SCALE, SCREEN_WIDTH, 14/WIDTH_6_SCALE)];
        [self label:self.nameLab withFont:DEF_FontSize_13 withText:@"用户姓名" withTextColor:getColor(@"f9d047") withTextAlignment:NSTextAlignmentCenter withView:_headerView withBGColor:[UIColor clearColor]];
        //为更多人加入
        UILabel * forMoreLab = [[UILabel alloc] initWithFrame:CGRectMake(0, self.nameLab.bottom + 16/WIDTH_6_SCALE, SCREEN_WIDTH, 14/WIDTH_6_SCALE)];
        [self label:forMoreLab withFont:DEF_FontSize_13 withText:@"您可为更多家人加入" withTextColor:getColor(greenBGColor) withTextAlignment:NSTextAlignmentCenter withView:_headerView withBGColor:[UIColor clearColor]];
        //立即加入按钮
        int forFamilyBtnH = 44/WIDTH_6_SCALE;
        UIButton * forFamilyBtn = [[UIButton alloc] initWithFrame:CGRectMake(88/WIDTH_6_SCALE, forMoreLab.bottom + 24/WIDTH_6_SCALE, SCREEN_WIDTH - 88/WIDTH_6_SCALE * 2, forFamilyBtnH)];
        [self button:forFamilyBtn withBGColor:getColor(greenBGColor) withLayerBorderColor:nil withLayerBorderWith:0 withCornerRadius:forFamilyBtnH/2 withMasksToBounds:YES withViwe:_headerView];
        [forFamilyBtn setBackgroundImage:[UIImage imageNamed:@"maself_bg"] forState:UIControlStateNormal];
        [forFamilyBtn setTitle:@"立即为家人加入" forState:UIControlStateNormal];
        [forFamilyBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        forFamilyBtn.titleLabel.font = DEF_FontSize_16;
        //白色背景
        [self setUpHeaderWhiteBGViews];
    }return _headerView;
}
- (void)setUpHeaderWhiteBGViews{//白色背景
    UIView * whiteBGView = [[UIView alloc] initWithFrame:CGRectMake(0, self.bgImg.bottom, SCREEN_WIDTH, _headerView.height - self.bgImg.height)];
    whiteBGView.backgroundColor = [UIColor whiteColor];
    [_headerView addSubview:whiteBGView];
    //标语
    UILabel * sloganLab = [[UILabel alloc] initWithFrame:CGRectMake(0, 18/WIDTH_6_SCALE, SCREEN_WIDTH, 16/WIDTH_6_SCALE)];
    [self label:sloganLab withFont:DEF_FontSize_14 withText:@"互助就是人人为我，我为人人" withTextColor:[UIColor blackColor] withTextAlignment:NSTextAlignmentCenter withView:whiteBGView withBGColor:[UIColor clearColor]];
    for (int i = 0; i<3; i++) {
        //图片
        UIImageView * iconImg = [[UIImageView alloc] initWithFrame:CGRectMake(0, sloganLab.bottom + 19/WIDTH_6_SCALE, 20/WIDTH_6_SCALE, 20/WIDTH_6_SCALE)];
//        iconImg.backgroundColor = [UIColor brownColor];
        iconImg.centerX = SCREEN_WIDTH / 3 / 2 + (SCREEN_WIDTH / 3)*i;
        [whiteBGView addSubview:iconImg];
        iconImg.tag = 2000+i;
        //说明
        UILabel * titleLab = [[UILabel alloc] initWithFrame:CGRectMake(0, iconImg.bottom + 8/WIDTH_6_SCALE, 80/WIDTH_6_SCALE, 14/WIDTH_6_SCALE)];
        [self label:titleLab withFont:DEF_FontSize_12 withText:@"平均充值" withTextColor:getColor(@"bcbcbc") withTextAlignment:NSTextAlignmentCenter withView:whiteBGView withBGColor:[UIColor clearColor]];
        titleLab.centerX = SCREEN_WIDTH / 3 / 2 + (SCREEN_WIDTH / 3)*i;
        titleLab.tag = 3000+i;
        //具体数额
        UILabel * contentLab = [[UILabel alloc] initWithFrame:CGRectMake(0, titleLab.bottom + 6/WIDTH_6_SCALE, 80/WIDTH_6_SCALE, 14/WIDTH_6_SCALE)];
        [self label:contentLab withFont:DEF_FontSize_12 withText:@"4个月" withTextColor:[UIColor blackColor] withTextAlignment:NSTextAlignmentCenter withView:whiteBGView withBGColor:[UIColor clearColor]];
        contentLab.centerX = SCREEN_WIDTH / 3 / 2 + (SCREEN_WIDTH / 3)*i;
        contentLab.tag = 4000+i;
    }
    UIImageView * chargeImg = (UIImageView *)[whiteBGView viewWithTag:2000];
    chargeImg.image = [UIImage imageNamed:@"svg_icon"];
    UIImageView * rightImg = (UIImageView *)[whiteBGView viewWithTag:2001];
    rightImg.image = [UIImage imageNamed:@"VIP_icon"];
    UIImageView * familyImg = (UIImageView *)[whiteBGView viewWithTag:2002];
    familyImg.image = [UIImage imageNamed:@"love_icon"];
    UILabel * chargeTitleLab = (UILabel *)[whiteBGView viewWithTag:3000];
    chargeTitleLab.text = @"平均充值";
    UILabel * rightTitleLab = (UILabel *)[whiteBGView viewWithTag:3001];
    rightTitleLab.text = @"延长权益";
    UILabel * familyTitleLab = (UILabel *)[whiteBGView viewWithTag:3002];
    familyTitleLab.text = @"挽救家庭";
    self.chargeContentLab = (UILabel *)[whiteBGView viewWithTag:4000];
    self.rightContentLab = (UILabel *)[whiteBGView viewWithTag:4001];
    self.familyContentLab = (UILabel *)[whiteBGView viewWithTag:4002];
    self.chargeContentLab.text = @"约9元";
    self.rightContentLab.text = @"4个月";
    self.familyContentLab.text = @"100个";
}
- (UIView *)footerView{
    if (!_footerView) {
        _footerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 129/WIDTH_6_SCALE)];
        _footerView.backgroundColor = getColor(@"f5f5f5");
        UIView * lineView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 1/WIDTH_6_SCALE)];
        lineView.backgroundColor = getColor(@"eeeeee");
        [_footerView addSubview:lineView];
        UIView * whiteView = [[UIView alloc] initWithFrame:CGRectMake(0, 9/WIDTH_6_SCALE, SCREEN_WIDTH, 120/WIDTH_6_SCALE)];
        whiteView.backgroundColor = [UIColor whiteColor];
        [_footerView addSubview:whiteView];//标题
        UILabel * titleLab = [[UILabel alloc] initWithFrame:CGRectMake(0, 13/WIDTH_6_SCALE, SCREEN_WIDTH, 15/WIDTH_6_SCALE)];
        [self label:titleLab withFont:DEF_FontSize_14 withText:@"博帮互助至今累计" withTextColor:[UIColor blackColor] withTextAlignment:NSTextAlignmentCenter withView:whiteView withBGColor:[UIColor clearColor]];
        self.totalPersonContentLab = [[UILabel alloc] initWithFrame:CGRectMake(0, 25/WIDTH_6_SCALE + titleLab.bottom, SCREEN_WIDTH/2, 23/WIDTH_6_SCALE)];//已帮助人数
        [self label:self.totalPersonContentLab withFont:DEF_FontSize_16 withText:@"37820999" withTextColor:getColor(greenBGColor) withTextAlignment:NSTextAlignmentCenter withView:whiteView withBGColor:[UIColor clearColor]];
        self.totalMoneyContentLab = [[UILabel alloc] initWithFrame:CGRectMake(self.totalPersonContentLab.right, self.totalPersonContentLab.top, SCREEN_WIDTH/2, self.totalPersonContentLab.height)];//已划拨互助款（元）
        [self label:self.totalPersonContentLab withFont:DEF_FontSize_16 withText:@"123950192" withTextColor:getColor(greenBGColor) withTextAlignment:NSTextAlignmentCenter withView:whiteView withBGColor:[UIColor clearColor]];
        UILabel * totalPersonTitleLab = [[UILabel alloc] initWithFrame:CGRectMake(0, self.totalPersonContentLab.bottom + 10/WIDTH_6_SCALE, SCREEN_WIDTH/2, 14/WIDTH_6_SCALE)];//已帮助人数
        [self label:totalPersonTitleLab withFont:DEF_FontSize_14 withText:@"已帮助人数(人)" withTextColor:getColor(@"9b9b9b") withTextAlignment:NSTextAlignmentCenter withView:whiteView withBGColor:[UIColor clearColor]];
        UILabel * totalMoneyTitleLab = [[UILabel alloc] initWithFrame:CGRectMake(SCREEN_WIDTH/2, self.totalPersonContentLab.bottom + 10/WIDTH_6_SCALE, SCREEN_WIDTH/2, 14/WIDTH_6_SCALE)];//已帮助人数
        [self label:totalMoneyTitleLab withFont:DEF_FontSize_14 withText:@"已划拨互助款(元)" withTextColor:getColor(@"9b9b9b") withTextAlignment:NSTextAlignmentCenter withView:whiteView withBGColor:[UIColor clearColor]];
        UIView * borderLineView = [[UIView alloc] initWithFrame:CGRectMake(0, 30/WIDTH_6_SCALE + titleLab.bottom, 1/WIDTH_6_SCALE, 38/WIDTH_6_SCALE)];
        borderLineView.centerX = SCREEN_WIDTH/2;
        borderLineView.backgroundColor = getColor(@"d8d8d8");
        [_footerView addSubview:borderLineView];
    }return _footerView;
}
- (NSMutableArray *)storyArr{
    if (!_storyArr) {
        _storyArr = @[
  @{@"content":@"是四大四大四大四大四大飒飒大师大师大师大师的按时打算打算打算打实打实的"},
  @{@"content":@"是四大四大四大四大四大飒飒大师大师大师大师的按时打算打算打算打实打实的是四大四大四大四大四大飒飒大师大师大师大师的按时打算打算打算打实打实的是四大四大四大四大四大飒飒大师大师大师大师的按时打算打算打算打实打实的是四大四大四大四大四大飒飒大师大师大师大师的按时打算打算打算打实打实的是四大四大四大四大四大飒飒大师大师大师大师的按时打算打算打算打实打实的"},
  @{@"content":@"是四大四大四大四大四大飒飒大师大师大师大师的按时打算打算打算打实打实的是四大四大四大四大四大飒飒大师大师大师大师的按时打算打算打算打实打实的是四大四大四大四大四大飒飒大师大师大师大师的按时打算打算打算打实打实的是四大四大四大四大四大飒飒大师大师大师大师的按时打算打算打算打实打实的是四大四大四大四大四大飒飒大师大师大师大师的按时打算打算打算打实打实的是四大四大四大四大四大飒飒大师大师大师大师的按时打算打算打算打实打实的是四大四大四大四大四大飒飒大师大师大师大师的按时打算打算打算打实打实的是四大四大四大四大四大飒飒大师大师大师大师的按时打算打算打算打实打实的是四大四大四大四大四大飒飒大师大师大师大师的按时打算打算打算打实打实的是四大四大四大四大四大飒飒大师大师大师大师的按时打算打算打算打实打实的"},].mutableCopy;
    }return _storyArr;
}
- (NSMutableArray *)messageArr{
    if (!_messageArr) {
        _messageArr = @[
  @{@"userWord":@"常量CELL_CONTENT_WIDTH是整个cell的宽度。", @"userData":@"1月前", @"officialWord":@"义不容辞的责任义不容辞的责任义不容辞的责任义不容辞的责任义不容辞的责任义不容辞的责任义不容辞的责任义不容辞的责任义不容辞的责任义不容辞的责任义不容辞的责任义不容辞的责任义不容辞的责任", @"officialData":@"1月前", @"userNum":@"1", @"officialNum":@"1"},
  @{@"userWord":@"首先我们要创建一个内容宽度的约束条件。CGSizeMake的第一个参量是总共的内容宽度减去两个页边空白。因为左边和右边各有一个页边空白。第二个参数是我们提供的最大数值。", @"userData":@"10月前", @"officialWord":@"义不容辞的责任", @"officialData":@"1月前", @"userNum":@"2", @"officialNum":@"2"},
  @{@"userWord":@"这个约束条件在后面的函数-sizeWithFont中将会用到。在-sizeWithFont中我们设置为 UILineBreakModeWordWrap来获取在允许自动换行的情况和上面提到的约束条件下正确的大小。最后我们使用MAX宏设置cell的高度，并且保证cell 的高度不会小于44个像素，因为它返回size.height和44两个数中的最大值。最后,我们将上下的页边空白考虑进去得到最后的结果。", @"userData":@"3月前", @"officialWord":@"义不容辞的责任", @"officialData":@"2月前", @"userNum":@"3", @"officialNum":@"3"},
  @{@"userWord":@"这并不是完整的代码因为我们仅仅在创建单元格的时候初始化它的label，这段代码对应调用-dequeueReusableCellWithIdentifier之后的判断模块if(cell == nil)。 在这里我想强调两点：第一个，我们可以注意到label有一个标签与其对应，因为调用了-setTag:1。当cell不等于nil时这个标签可以用到。第二点，我们通过调用[[cell contentView] addSubview:label]来将label添加到单元格的内容视图中，这个只是在label初始化的时候用到。每调用这个函数都会添加label 到子视图序列中。下面我们会将这段代码补充完整，但之前先让我们看一下如何设置cell的高度", @"userData":@"8月前", @"officialWord":@"义不容辞的责任", @"officialData":@"3月前", @"userNum":@"4", @"officialNum":@"4"}].mutableCopy;
    }return _messageArr;
}
#pragma mark - tableViewDelegate和tableViewDataSource
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    UITableViewCell * cell = nil;
    if (indexPath.section == 0) {
        MemberStoryTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([MemberStoryTableViewCell class]) forIndexPath:indexPath];
        cell.model = self.storyArr[indexPath.row];
        if (indexPath.row == 0) {
            cell.topVerticalDashLine.hidden = YES;
        }else{
            cell.topVerticalDashLine.hidden = NO;
        }
        if (indexPath.row == self.storyArr.count - 1) {
            cell.bottomVerticalDashLine.hidden = YES;
        }else{
            cell.bottomVerticalDashLine.hidden = NO;
        }
        return cell;
    }else{
        LeaveMessageTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([LeaveMessageTableViewCell class]) forIndexPath:indexPath];
        cell.model = self.messageArr[indexPath.row];
        if (indexPath.row == self.messageArr.count - 1) {
            cell.bottomLineView.hidden = YES;
        }else{
            cell.bottomLineView.hidden = NO;
        }
        return cell;
    }
    return cell;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.section == 0) {
        return [MemberStoryTableViewCell heightForCellWithComment:self.storyArr[indexPath.row]];
    }else{
        return [LeaveMessageTableViewCell heightForCellWithComment:self.messageArr[indexPath.row]];
    }
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    if (section == 0) {
        return self.storyArr.count;
    }else{
        return self.messageArr.count;
    }
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 2;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    if (section == 0) {
        return 115/WIDTH_6_SCALE;
    }else{
        return 50/WIDTH_6_SCALE;
    }
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
    UIView * headerView = [[UIView alloc] init];//组头背景
    headerView.backgroundColor = getColor(@"f5f5f5");
    UIView * whiteView = [[UIView alloc] init];//白色背景
    [headerView addSubview:whiteView];
    int labW = 110/WIDTH_6_SCALE;
    int labX = 16/WIDTH_6_SCALE;
    whiteView.backgroundColor = [UIColor whiteColor];
    UILabel * titleLab = [[UILabel alloc] init];//组头标题
    [self label:titleLab withFont:DEF_FontSize_12 withText:@"" withTextColor:[UIColor blackColor] withTextAlignment:NSTextAlignmentLeft withView:whiteView withBGColor:[UIColor clearColor]];
    UILabel * contentLab = [[UILabel alloc] init];//内容说明
    [self label:contentLab withFont:DEF_FontSize_10 withText:@"" withTextColor:nil withTextAlignment:NSTextAlignmentRight withView:whiteView withBGColor:[UIColor clearColor]];
    UIView * lineView = [[UIView alloc] init];//分割线
    lineView.backgroundColor = getColor(@"eeeeee");
    [whiteView addSubview:lineView];
    if (section == 0) {
        headerView.frame = CGRectMake(0, 0, SCREEN_WIDTH, 115/WIDTH_6_SCALE);
        whiteView.frame = CGRectMake(0, 9/WIDTH_6_SCALE, SCREEN_WIDTH, headerView.height - 9/WIDTH_6_SCALE);
        titleLab.frame = CGRectMake(labX, 0, labW, 40/WIDTH_6_SCALE);
        contentLab.frame = CGRectMake(SCREEN_WIDTH - labW - labX, 0, labW, titleLab.height);
        titleLab.text = @"如何领取互助金";
        contentLab.text = @"会员故事帮你了解";
        contentLab.userInteractionEnabled = NO;
        contentLab.textColor = getColor(@"bcbcbc");
        lineView.frame = CGRectMake(0, 40/WIDTH_6_SCALE, SCREEN_WIDTH, 1/WIDTH_6_SCALE);
        self.patientNameLab = [[UILabel alloc] init];//患者名
        self.patientNameLab.frame = CGRectMake(titleLab.left, lineView.bottom + 17/WIDTH_6_SCALE, 50/WIDTH_6_SCALE, 18/WIDTH_6_SCALE);
        [self label:self.patientNameLab withFont:DEF_FontSize_12 withText:@"王宝强" withTextColor:[UIColor blackColor] withTextAlignment:NSTextAlignmentCenter withView:whiteView withBGColor:[UIColor clearColor]];
        self.diseaseLab = [[UILabel alloc] init];//疾病名
        self.diseaseLab.frame = CGRectMake(self.patientNameLab.right, 0, 50/WIDTH_6_SCALE, self.nameLab.height);
        self.diseaseLab.centerY = self.patientNameLab.centerY;
        [self label:self.diseaseLab withFont:DEF_FontSize_10 withText:@"鼻咽癌" withTextColor:getColor(greenBGColor) withTextAlignment:NSTextAlignmentCenter withView:whiteView withBGColor:getColor(@"e0f7f0")];
        self.stateLab = [[UILabel alloc] init];//城市以及申请资金
        self.stateLab.frame = CGRectMake(self.patientNameLab.left, self.patientNameLab.bottom + 10/WIDTH_6_SCALE, SCREEN_WIDTH - self.patientNameLab.left - 60/WIDTH_6_SCALE, 14/WIDTH_6_SCALE);
        [self label:self.stateLab withFont:DEF_FontSize_10 withText:@"北京………………" withTextColor:getColor(@"9b9b9b") withTextAlignment:NSTextAlignmentLeft withView:whiteView withBGColor:[UIColor clearColor]];
        self.iconImg = [[UIImageView alloc] init];//头像
        self.iconImg.frame = CGRectMake(SCREEN_WIDTH - 45/WIDTH_6_SCALE, 0, 30/WIDTH_6_SCALE, 30/WIDTH_6_SCALE);
        self.iconImg.image = [UIImage imageNamed:@"head_login_icon"];
        [whiteView addSubview:self.iconImg];
        self.iconImg.centerY = (self.stateLab.bottom - self.patientNameLab.top)/2 + self.patientNameLab.top;
    }else{
        headerView.frame = CGRectMake(0, 0, SCREEN_WIDTH, 50/WIDTH_6_SCALE);
        whiteView.frame = CGRectMake(0, 9/WIDTH_6_SCALE, SCREEN_WIDTH, headerView.height - 9/WIDTH_6_SCALE);
        titleLab.frame = CGRectMake(labX, 0, labW, whiteView.height);
        contentLab.frame = CGRectMake(SCREEN_WIDTH - labW - labX, 0, labW, titleLab.height);
        titleLab.text = @"精选留言";
        contentLab.text = @"写留言";
        contentLab.userInteractionEnabled = YES;
        contentLab.textColor = getColor(greenBGColor);
        lineView.frame = CGRectMake(0, whiteView.height - 1, SCREEN_WIDTH, 1/WIDTH_6_SCALE);
        UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(leaveMessage)];
        [contentLab addGestureRecognizer:tap];
    }return headerView;
}
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
    if (section == 1) {
        UIView * footerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 38/WIDTH_6_SCALE)];
        footerView.backgroundColor = [UIColor whiteColor];
        UIButton * moreBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 38/WIDTH_6_SCALE - 16/WIDTH_6_SCALE)];
        [moreBtn setTitle:@"点击加载更多" forState:UIControlStateNormal];
        [moreBtn setTitleColor:getColor(@"9b9b9b") forState:UIControlStateNormal];
        moreBtn.titleLabel.font = DEF_FontSize_13;
        [moreBtn addTarget:self action:@selector(moreBtnClick) forControlEvents:UIControlEventTouchUpInside];
        [footerView addSubview:moreBtn];
        return footerView;
    }else{
        return nil;
    }
}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    if (section == 1) {
        return 38/WIDTH_6_SCALE;
    }else{
        return 0;
    }
}
#pragma mark - action
- (void)moreBtnClick{
    NSLog(@"点击加载更多");
}
- (void)leaveMessage{
    NSLog(@"留言");
}
@end
